package com.wzd.mphelper.mphelpertest.controller;

import com.wzd.mphelper.mphelpertest.entity.LandPlantingInfo;
import com.wzd.mphelper.mphelpertest.service.ILandPlantingInfoService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
public class LandPlantingInfoController {

    @Resource
    private ILandPlantingInfoService landPlantingInfoService;

    @PostMapping("/saveLandPlantingInfos1")
    public void saveLandPlantingInfos(@RequestParam("plantCycleId") Long plantCycleId) {
        List<LandPlantingInfo> landPlantingInfos = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            LandPlantingInfo landPlantingInfo = new LandPlantingInfo();
            landPlantingInfo.setPlantCycleId(plantCycleId);
            landPlantingInfo.setTntId("dhzy");
            landPlantingInfo.setIdytpCd("dhzy");
            landPlantingInfo.setCompanyId("1");
            landPlantingInfo.setCompanyName("2");
            landPlantingInfo.setBaseId(1L);
            landPlantingInfo.setBaseNm("基地1");
            landPlantingInfo.setLandNo(i + "");
            landPlantingInfo.setLandId(Long.parseLong(i + ""));
            landPlantingInfo.setUserId(Long.parseLong(i + ""));
            landPlantingInfos.add(landPlantingInfo);
        }
        landPlantingInfoService.saveLandPlantingInfos(landPlantingInfos);
    }
}
